ss = input()
ss = ss[1:-1]
import re
ss = re.findall(r'{(.*?)}', ss)

stu_list = []
for x in ss:
    s = x.split(",")
    cur = []
    stu_data = {}
    for v in s:
        a = v.split(":")
        cur.append(a[1])
    stu_data["name"] = cur[0][1:-1]
    stu_data["class"] = int(cur[1])
    stu_data["score"] = int(cur[2])
    stu_list.append(stu_data)


def insert_sort(lists):
    count = len(lists)
    for i in range(1, count):
        key = lists[i]
        j = i - 1
        while j >= 0:
            if lists[j]["class"] > key["class"]:
                lists[j+1]["class"] = lists[j]["class"]
                lists[j] = key
            j -= 1
    return lists



stu_list = insert_sort(stu_list)
print(stu_list)



